package fr.ece.ing4.inf442.cours2;


public class DemoSynchronize {
	static Counter c = new Counter();

	public static void main(String[] args) throws InterruptedException {
		Thread a = new Thread() {
			@Override
			public void run() {
				synchronized (DemoSynchronize.c) {
					DemoSynchronize.c.increment();
				}
			}
		};
		Thread b = new Thread() {
			@Override
			public void run() {
				synchronized (DemoSynchronize.c) {
					DemoSynchronize.c.decrement();
				}
			}
		};
		a.start();
		b.start();
		a.join();
		b.join();
		System.out.println(DemoSynchronize.c.value());
	}
}
